<?php

//连接到数据库
class db{
    function __construct(){
        $this->mysqli = new mysqli('localhost', 'root', '', 'blog1');
        if ($this->mysqli->connect_error) {
            die('Connect Error (' . $this->mysqli->connect_errno . ') '
                . $this->mysqli->connect_error);
        }
        $this->mysqli->query('SET NAMES UTF8');
    }
    function query($sql){
        return $this->mysqli->query($sql);
    }



}